package cn.befory.tools;

import cn.befory.exception.ExceptionEnum;

/**
 * Created by befory on 2019/8/20.
 */
public class ResponseContent {
    private int code;

    private String msg;

    private Object data;

    public ResponseContent(ExceptionEnum exceptionEnum, Object data) {
        this.code = exceptionEnum.getCode();
        this.msg = exceptionEnum.getMsg();
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public ResponseContent setCode(int code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public ResponseContent setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Object getData() {
        return data;
    }

    public ResponseContent setData(Object data) {
        this.data = data;
        return this;
    }


    public static ResponseContent success(Object obj){
        return new ResponseContent(ExceptionEnum.SUCCESS,obj);
    }
}
